package com.esri.core.portal;

import com.esri.core.ags.TileInfo;
import com.esri.core.geometry.Envelope;
import com.esri.core.geometry.SpatialReference;
import com.esri.core.internal.io.handler.d;
import com.esri.core.internal.tasks.ags.am;
import com.esri.core.internal.value.f;
import com.esri.core.map.ImageServiceParameters;
import com.esri.core.map.MosaicRule;
import com.esri.core.map.RasterFunction;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/* loaded from: classes.dex */
public class WebMapLayer {
    static final Map<String, f> B = new LinkedHashMap<String, f>() { // from class: com.esri.core.portal.WebMapLayer.1
        private static final int a = 5;
        private static final long serialVersionUID = 1;

        @Override // java.util.LinkedHashMap
        protected boolean removeEldestEntry(Map.Entry<String, f> entry) {
            return size() > 5;
        }
    };
    List<String> C;
    String D;
    List<SpatialReference> E;
    Envelope F;
    String G;
    String H;
    String I;
    List<Integer> M;
    RasterFunction N;
    MosaicRule O;
    ImageServiceParameters.IMAGE_FORMAT P;
    ImageServiceParameters.RSP R;
    String S;
    ImageServiceParameters.NoDataInterpretation T;
    String U;
    String V;
    String W;
    TileInfo X;
    String a;
    String b;
    String e;
    String f;
    boolean g;
    List<Integer> h;
    List<Integer> i;
    List<Integer> j;
    public boolean mIsBaseLayer;
    boolean c = true;
    float d = 1.0f;
    Type k = Type.ARCGIS;
    Mode l = Mode.ONDEMAND;
    FeatureCollection m = null;
    double n = Double.NaN;
    double o = Double.NaN;
    String p = null;
    String q = null;
    ArrayList<String> r = new ArrayList<>();
    WebMapPopupInfo s = null;
    List<WebMapSubLayer> t = null;
    boolean u = true;
    String v = null;
    String w = null;
    String x = null;
    String y = null;
    List<Integer> z = null;
    String A = null;
    String J = null;
    boolean K = false;
    boolean L = false;
    int Q = -1;

    /* loaded from: classes.dex */
    public enum Mode {
        SNAPSHOT,
        ONDEMAND,
        SELECTION
    }

    /* loaded from: classes.dex */
    public enum Type {
        ARCGIS,
        OPEN_STREET_MAP,
        BING_MAPS_AERIAL,
        BING_MAPS_ROAD,
        BING_MAPS_AERIAL_WITH_LABELS,
        CSV,
        WMS,
        KML,
        FEATURE_COLLECTION,
        WMTS
    }

    protected WebMapLayer() {
    }

    protected WebMapLayer(String str, String str2) {
        this.e = str;
        this.a = str2;
    }

    public String getUrl() {
        return this.a;
    }

    public String getID() {
        return this.b;
    }

    public boolean isVisible() {
        return this.c;
    }

    public String getLayerDefinitionOverride() {
        return this.p;
    }

    public String getCapabilitiesOverride() {
        return this.q;
    }

    public float getOpacity() {
        return this.d;
    }

    public String getLocationType() {
        return this.v;
    }

    public String getLongitudeFieldName() {
        return this.x;
    }

    public WebMapPopupInfo getWebMapPopupInfo() {
        if (this.L) {
            return null;
        }
        return this.s;
    }

    public String getLatitudeFieldName() {
        return this.w;
    }

    public String getColumnDelimiter() {
        return this.y;
    }

    public List<SpatialReference> getSpatialRefs() {
        return this.E;
    }

    public Envelope getExtent() {
        return this.F;
    }

    public String getCopyright() {
        return this.H;
    }

    @Deprecated
    public String getFormat() {
        return this.I;
    }

    public TileInfo getTileInfo() {
        return this.X;
    }

    public String getWmsVersion() {
        return this.D;
    }

    public String getMapUrl() {
        return this.G;
    }

    public List<String> getWmsVisibleLayers() {
        return this.C;
    }

    public String getTitle() {
        try {
            if (this.e == null) {
                this.e = this.a.split("services/")[1].replace("/", "_");
            }
            return this.e;
        } catch (Exception unused) {
            return this.a;
        }
    }

    public List<WebMapSubLayer> getLayers() {
        return this.t;
    }

    public String getItemId() {
        return this.f;
    }

    public boolean isReference() {
        return this.g;
    }

    public int[] getVisibleLayers() {
        List<Integer> list = this.h;
        int i = 0;
        if (list == null || list.size() == 0) {
            return new int[0];
        }
        int[] iArr = new int[this.h.size()];
        for (Integer num : this.h) {
            iArr[i] = num.intValue();
            i++;
        }
        return iArr;
    }

    public int[] getInvisibleLegendLayers() {
        List<Integer> list = this.i;
        int i = 0;
        if (list == null || list.size() == 0) {
            return new int[0];
        }
        int[] iArr = new int[this.i.size()];
        for (Integer num : this.i) {
            iArr[i] = num.intValue();
            i++;
        }
        return iArr;
    }

    public int[] getDisplayLevels() {
        List<Integer> list = this.j;
        int i = 0;
        if (list == null || list.size() == 0) {
            return new int[0];
        }
        int[] iArr = new int[this.j.size()];
        for (Integer num : this.j) {
            iArr[i] = num.intValue();
            i++;
        }
        return iArr;
    }

    public int[] getBandIds() {
        List<Integer> list = this.M;
        if (list == null) {
            return null;
        }
        Integer[] numArr = (Integer[]) list.toArray(new Integer[0]);
        int[] iArr = new int[numArr.length];
        for (int i = 0; i < numArr.length; i++) {
            iArr[i] = numArr[i].intValue();
        }
        return iArr;
    }

    public Mode getMode() {
        return this.l;
    }

    public Type getType() {
        return this.k;
    }

    public FeatureCollection getFeatureCollection() {
        return this.m;
    }

    public double getMinScale() {
        return this.n;
    }

    public double getMaxScale() {
        return this.o;
    }

    public ArrayList<String> getLayerDefinitions() {
        return this.r;
    }

    public boolean isShowLegend() {
        return this.u;
    }

    public int[] getVisibleFolders() {
        List<Integer> list = this.z;
        if (list == null || list.size() <= 0) {
            return null;
        }
        int[] iArr = new int[this.z.size()];
        int i = 0;
        for (Integer num : this.z) {
            iArr[i] = num.intValue();
            i++;
        }
        return iArr;
    }

    public boolean isDisablePopup() {
        return this.L;
    }

    public boolean isFederated(String str) {
        if (!this.K) {
            this.J = a();
            this.K = true;
        }
        String str2 = this.J;
        return str2 != null && str2.length() >= 1 && d.a(this.J, str);
    }

    private String a() {
        f fVar;
        String url = getUrl();
        if (url == null) {
            return null;
        }
        int lastIndexOf = url.lastIndexOf("rest/");
        if (lastIndexOf > 0) {
            String str = url.substring(0, lastIndexOf + 5) + "info";
            try {
                Map<String, f> map = B;
                synchronized (map) {
                    if (!map.containsKey(str)) {
                        fVar = new am(str, null).execute();
                        map.put(str, fVar);
                    } else {
                        fVar = map.get(str);
                    }
                }
            } catch (Exception unused) {
                return null;
            }
        } else {
            fVar = null;
        }
        if (fVar != null) {
            return fVar.a();
        }
        return null;
    }

    public String getPortalUrl() {
        return this.A;
    }

    public RasterFunction getRenderingRule() {
        return this.N;
    }

    public MosaicRule getMosaicRule() {
        return this.O;
    }

    public ImageServiceParameters.IMAGE_FORMAT getImageFormat() {
        return this.P;
    }

    public int getImageCompressionQuality() {
        return this.Q;
    }

    public ImageServiceParameters.RSP getImageInterpolation() {
        return this.R;
    }

    public String getImageNoDataPixelValue() {
        return this.S;
    }

    public ImageServiceParameters.NoDataInterpretation getImageNoDataInterpretation() {
        return this.T;
    }

    public String getWmtsTemplateUrl() {
        return this.W;
    }

    public String getWmtsLayerId() {
        return this.U;
    }

    public String getWmtsTileMatrixSetId() {
        return this.V;
    }

    /*  JADX ERROR: JadxRuntimeException in pass: BlockProcessor
        jadx.core.utils.exceptions.JadxRuntimeException: CFG modification limit reached, blocks count: 589
        	at jadx.core.dex.visitors.blocks.BlockProcessor.processBlocksTree(BlockProcessor.java:59)
        	at jadx.core.dex.visitors.blocks.BlockProcessor.visit(BlockProcessor.java:39)
        */
    protected static com.esri.core.portal.WebMapLayer fromJson(org.codehaus.jackson.JsonParser r13) throws com.esri.core.portal.PortalException {
        /*
            Method dump skipped, instructions count: 1730
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: com.esri.core.portal.WebMapLayer.fromJson(org.codehaus.jackson.JsonParser):com.esri.core.portal.WebMapLayer");
    }
}
